﻿using csharp_mvcintro.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace csharp_mvcintro.Controllers
{
    public class HomeController : Controller
    {

        public ActionResult Index()
        {
            TodoVm myVm = new TodoVm();
            myVm.Greeting = "hola mundo";
            myVm.MyList = ChoreHolder.GetMyChores();
            return View(myVm);
            //return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";
            ViewBag.greeting = "Hello World!";
            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";
            ViewBag.greeting = "Mahara Alam";
            return View();
        }

        public ActionResult Kitchen()
        {
            TodoVm myVm = new TodoVm();
            myVm.Greeting = "hola mundo";
            var filteredResults = ChoreHolder.GetMyChores();
            var finalRes = filteredResults
                .Where(n => n.ChoreType == "Kitchen")
                .ToList();
            myVm.MyList = finalRes;
    
            return View(myVm);
        }
        public ActionResult Bedroom()
        {
            TodoVm myVm = new TodoVm();
            var filteredRes = ChoreHolder.GetMyChores();
            var finalResults = filteredRes
                .Where(c => c.ChoreType == "Bedroom")
                .ToList();
            myVm.MyList = finalResults;
            return View(myVm);
        }
        public ActionResult Garage()
        {
            return View();
        }
    }
}